<template>
  <div class="app-container">
    <micro-app
      name="todo"
      :url="url"
      iframe
      style="width: 100%"
      @datachange="todoDataChange"
      @created="created"
      @beforemount="beforemount"
      @mounted="mounted"
      @unmount="unmount"
      @error="todoError"
    ></micro-app>
  </div>
</template>
  
  <script setup name="Online">
const url = ref(import.meta.env.VITE_APP_SUB_CHILD1);

const todoSuccess = ref(true);

function todoDataChange() {
  let todoData = microApp.getData("todo");
  // dataForChild2.value = todoData;
  console.log("todoData", todoData);
}

function created() {
  console.log("created");
}
function beforemount() {
  console.log("beforemount");
}
function mounted() {
  console.log("mounted");
}
function unmount() {
  // todoSuccess.value = false;
  console.log("unmount");
}
function todoError() {
  todoSuccess.value = false;
  console.log("子应用加载出错");
}
</script>
  